Closed
Bug 604631
Opened 15 years ago
Closed 15 years ago
nsPrintEngine::SetupToPrintContent() leaks docTitleStr and docURLStr if mIsCreatingPrintPreview & !seqFrame
Categories
(Core :: Printing: Output, defect)
Core
Printing: Output
Tracking
()
RESOLVED
FIXED
mozilla2.0b8
People
(Reporter: timeless, Assigned: timeless)
References
(Blocks 1 open bug)
Details
(Keywords: coverity, memory-leak)
Attachments
(1 file)
964 bytes,
patch
|
dholbert
:
review+
benjamin
:
approval2.0+
|
Details | Diff | Splinter Review |
1650 nsPrintEngine::SetupToPrintContent()
1771 PRUnichar * docTitleStr;
1773 GetDisplayTitleAndURL(mPrt->mPrintObject, &docTitleStr, &docURLStr, eDocTitleDefURLDoc);
1797 if (mIsCreatingPrintPreview) {
1798 // Print Preview -- Pass ownership of docTitleStr and docURLStr
1799 // to the pageSequenceFrame, to be displayed in the header
1800 nsIPageSequenceFrame *seqFrame = mPrt->mPrintObject->mPresShell->GetPageSequenceFrame();
1801 if (seqFrame) {
1802 seqFrame->StartPrint(mPrt->mPrintObject->mPresContext,
1803 mPrt->mPrintSettings, docTitleStr, docURLStr);
this should 0 docURLStr and docTitleStr to show that ownership is transfered
1804 }
We leak docURLStr and docTitleStr here if !seqFrame.
the following should not be in an else block:
1805 } else {
1806 if (docTitleStr) nsMemory::Free(docTitleStr);
1807 if (docURLStr) nsMemory::Free(docURLStr);
1808 }
1812 NS_ENSURE_SUCCESS(rv, rv);
1823 return rv;
Comment 2•15 years ago
|
||
Comment on attachment 483783 [details] [diff] [review]
patch
Ah, good catch. Fix looks good.
Attachment #483783 -
Flags: review?(dholbert) → review+
Comment 3•15 years ago
|
||
Comment on attachment 483783 [details] [diff] [review]
patch
Requesting approval2.0. Low risk, fixes a potential leak.
Attachment #483783 -
Flags: approval2.0?
Updated•15 years ago
|
Component: Printing: Setup → Printing: Output
QA Contact: printing.setup → printing
Updated•15 years ago
|
Attachment #483783 -
Flags: approval2.0? → approval2.0+
Comment 4•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Updated•15 years ago
|
Target Milestone: --- → mozilla2.0b8
Updated•7 years ago
|
Blocks: coverity-analysis
You need to log in
before you can comment on or make changes to this bug.
Description
•